/*
 * 组件注释
 * @Author: machinist_wq
 * @Date: 2022-09-02 22:41:43
 * @LastEditors: machinist_wq
 * @LastEditTime: 2022-09-05 19:35:18
 * @Description: 相对比较简单的modal
 * 人生无常！大肠包小肠......
 */
"use strict";
import { Modal, ModalFuncProps, ModalProps } from "antd";
import { FC, ReactElement } from "react";

type IProps = ModalProps &
  ModalFuncProps & {
    handleOk: () => void;
    handleCancel: () => void;
  };
const Index: FC<IProps> = (props: IProps): ReactElement => {
  const {
    title,
    visible,
    handleOk = () => {},
    handleCancel = () => {},
    wrapClassName,
    ...otherProps
  } = props;

  return (
    <Modal
      title={title}
      visible={visible}
      onOk={handleOk}
      onCancel={handleCancel}
      destroyOnClose
      wrapClassName={`commonModal ${wrapClassName}`}
      bodyStyle={{
        minHeight: "20vh",
        maxHeight: "48vh",
        overflow: "auto",
        ...(!otherProps.footer ? { paddingBottom: 20 } : { marginBottom: 20 }),
      }}
      {...otherProps}>
      {props.children}
    </Modal>
  );
};
export default Index;
